<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    <title>gitlab维护 | Cucy的博客</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="gitlab">
    <meta name="description" content="缺省安装后的一些重要信息
程序目录在：/opt/gitlab
文件数据在：/var/opt/gitlab
git repo目录在：/var/opt/gitlab/git-data
上传图片目录在：/var/opt/gitlab/uploads
大文件、二进制文件目录在: /var/opt/gitlab/gitlab-rails/shared/lfs-objects
备份文件目录在: /var/op">
<meta property="og:type" content="article">
<meta property="og:title" content="gitlab维护">
<meta property="og:url" content="http://zhourudong.cn/2017/08/24/45-gitlab维护/index.html">
<meta property="og:site_name" content="Cucy的博客">
<meta property="og:description" content="缺省安装后的一些重要信息
程序目录在：/opt/gitlab
文件数据在：/var/opt/gitlab
git repo目录在：/var/opt/gitlab/git-data
上传图片目录在：/var/opt/gitlab/uploads
大文件、二进制文件目录在: /var/opt/gitlab/gitlab-rails/shared/lfs-objects
备份文件目录在: /var/op">
<meta property="og:updated_time" content="2019-02-22T05:28:07.829Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="gitlab维护">
<meta name="twitter:description" content="缺省安装后的一些重要信息
程序目录在：/opt/gitlab
文件数据在：/var/opt/gitlab
git repo目录在：/var/opt/gitlab/git-data
上传图片目录在：/var/opt/gitlab/uploads
大文件、二进制文件目录在: /var/opt/gitlab/gitlab-rails/shared/lfs-objects
备份文件目录在: /var/op">
    
        <link rel="alternate" type="application/atom+xml" title="Cucy的博客" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="/css/style.css?v=1.6.13">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.png">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">cucy</h5>
          <a href="mailto:292016176@qq.com" title="292016176@qq.com" class="mail">292016176@qq.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/cucy" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">gitlab维护</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">gitlab维护</h1>
        <h5 class="subtitle">
            
                <time datetime="2017-08-24T09:46:30.000Z" itemprop="datePublished" class="page-time">
  2017-08-24
</time>


            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#缺省安装后的一些重要信息"><span class="post-toc-number">1.</span> <span class="post-toc-text">缺省安装后的一些重要信息</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#管理"><span class="post-toc-number">2.</span> <span class="post-toc-text">管理</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#查看版本信息"><span class="post-toc-number">3.</span> <span class="post-toc-text">查看版本信息</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#数据库同步所有历史信息"><span class="post-toc-number">4.</span> <span class="post-toc-text">数据库同步所有历史信息</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#汉化"><span class="post-toc-number">5.</span> <span class="post-toc-text">汉化</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#确认GitLab版本"><span class="post-toc-number">5.1.</span> <span class="post-toc-text">确认GitLab版本</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#克隆代码"><span class="post-toc-number">5.2.</span> <span class="post-toc-text">克隆代码</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#比较汉化分支和原分支导出文件"><span class="post-toc-number">5.3.</span> <span class="post-toc-text">比较汉化分支和原分支导出文件</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#补丁"><span class="post-toc-number">5.4.</span> <span class="post-toc-text">补丁</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#备份恢复"><span class="post-toc-number">6.</span> <span class="post-toc-text">备份恢复</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#备份"><span class="post-toc-number">6.1.</span> <span class="post-toc-text">备份</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#恢复"><span class="post-toc-number">6.2.</span> <span class="post-toc-text">恢复</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#数据迁移"><span class="post-toc-number">6.3.</span> <span class="post-toc-text">数据迁移</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#pgsql修改"><span class="post-toc-number">7.</span> <span class="post-toc-text">pgsql修改</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#清缓存"><span class="post-toc-number">8.</span> <span class="post-toc-text">清缓存</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#大型文件、二进制文件对象相关"><span class="post-toc-number">9.</span> <span class="post-toc-text">大型文件、二进制文件对象相关</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#Gitaly-RPC调用配置"><span class="post-toc-number">10.</span> <span class="post-toc-text">Gitaly RPC调用配置</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#监控"><span class="post-toc-number">11.</span> <span class="post-toc-text">监控</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#白名单"><span class="post-toc-number">11.1.</span> <span class="post-toc-text">白名单</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#Prometheus-监控"><span class="post-toc-number">11.2.</span> <span class="post-toc-text">Prometheus 监控</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#设置redis-session过期"><span class="post-toc-number">11.3.</span> <span class="post-toc-text">设置redis session过期</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#CHECK"><span class="post-toc-number">12.</span> <span class="post-toc-text">CHECK</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#当前配置是否有问题"><span class="post-toc-number">12.1.</span> <span class="post-toc-text">当前配置是否有问题</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#Performance"><span class="post-toc-number">13.</span> <span class="post-toc-text">Performance</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#存储路径配置"><span class="post-toc-number">14.</span> <span class="post-toc-text">存储路径配置</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#升级参考地址"><span class="post-toc-number">15.</span> <span class="post-toc-text">升级参考地址</span></a></li></ol>
        </nav>
    </aside>
    
<article id="post-45-gitlab维护"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">gitlab维护</h1>
        <div class="post-meta">
            <time class="post-time" title="2017-08-24 17:46:30" datetime="2017-08-24T09:46:30.000Z"  itemprop="datePublished">2017-08-24</time>

            


            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="缺省安装后的一些重要信息"><a href="#缺省安装后的一些重要信息" class="headerlink" title="缺省安装后的一些重要信息"></a>缺省安装后的一些重要信息</h1><ul>
<li>程序目录在：<code>/opt/gitlab</code></li>
<li>文件数据在：<code>/var/opt/gitlab</code></li>
<li>git repo目录在：<code>/var/opt/gitlab/git-data</code></li>
<li>上传图片目录在：<code>/var/opt/gitlab/uploads</code></li>
<li>大文件、二进制文件目录在: <code>/var/opt/gitlab/gitlab-rails/shared/lfs-objects</code></li>
<li>备份文件目录在: <code>/var/opt/gitlab/backups</code></li>
<li>使用的本地模式运行的postgresql数据，会随gitlab启动时候自动运行,<code>socket模式没有监听端口</code></li>
<li>默认生成的配置文件位置: <code>/var/opt/gitlab/gitlab-rails/etc</code></li>
<li>使用本地运行的redis服务，会随gitlab启动时候自动运行<code>socket</code></li>
<li>缺省利用本地邮件，自动投递给其他服务器，如果是非互联网ip，可以修改为本地smtp方式</li>
<li>修改ssh服务的git账号入口，git账号的登录shell处理为gitlab-shell</li>
<li>自带nginx，缺省会在所有ip地址的80端口监听请求，请求会转发给ruby进程</li>
</ul>
<h1 id="管理"><a href="#管理" class="headerlink" title="管理"></a>管理</h1><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span> 所有组件状态</span><br><span class="line">sudo gitlab-ctl status</span><br><span class="line"><span class="meta"></span><br><span class="line">#</span> 启动所有 gitlab 组件：</span><br><span class="line">sudo gitlab-ctl start</span><br><span class="line"><span class="meta"></span><br><span class="line">#</span> 停止所有 gitlab 组件：</span><br><span class="line">sudo gitlab-ctl stop</span><br><span class="line"><span class="meta"></span><br><span class="line">#</span> 重启所有 gitlab 组件：</span><br><span class="line">sudo gitlab-ctl restart</span><br><span class="line"><span class="meta"></span><br><span class="line">#</span> 更新配置并重启</span><br><span class="line">sudo gitlab-ctl reconfigure</span><br><span class="line"><span class="meta"></span><br><span class="line">#</span> 看日志</span><br><span class="line">sudo gitlab-ctl tail</span><br></pre></td></tr></table></figure>
<h1 id="查看版本信息"><a href="#查看版本信息" class="headerlink" title="查看版本信息"></a>查看版本信息</h1><p><code>gitlab-rake gitlab:env:info RAILS_ENV=production</code><br><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">System information</span><br><span class="line">System:		CentOS 6.5</span><br><span class="line">Current User:	git</span><br><span class="line">Using RVM:	no</span><br><span class="line">Ruby Version:	2.3.3p222</span><br><span class="line">Gem Version:	2.6.6</span><br><span class="line">Bundler Version:1.13.7</span><br><span class="line">Rake Version:	10.5.0</span><br><span class="line">Redis Version:	3.2.5</span><br><span class="line">Git Version:	2.13.4</span><br><span class="line">Sidekiq Version:5.0.0</span><br><span class="line">Go Version:	unknown</span><br><span class="line"></span><br><span class="line">GitLab information</span><br><span class="line">Version:	9.4.5</span><br><span class="line">Revision:	140292e</span><br><span class="line">Directory:	/opt/gitlab/embedded/service/gitlab-rails</span><br><span class="line">DB Adapter:	postgresql</span><br><span class="line">URL:		http://gitlab.sh.45.com</span><br><span class="line">HTTP Clone URL:	http://gitlab.sh.45.com/some-group/some-project.git</span><br><span class="line">SSH Clone URL:	git@gitlab.sh.45.com:some-group/some-project.git</span><br><span class="line">Using LDAP:	no</span><br><span class="line">Using Omniauth:	no</span><br><span class="line"></span><br><span class="line">GitLab Shell</span><br><span class="line">Version:	5.3.1</span><br><span class="line">Repository storage paths:</span><br><span class="line">- default: 	/var/opt/gitlab/git-data/repositories</span><br><span class="line">Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks</span><br><span class="line">Git:		/opt/gitlab/embedded/bin/git</span><br></pre></td></tr></table></figure></p>
<h1 id="数据库同步所有历史信息"><a href="#数据库同步所有历史信息" class="headerlink" title="数据库同步所有历史信息"></a>数据库同步所有历史信息</h1><p>gitlab-rake  db:migrate:status RAILS_ENV=production</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">database: gitlabhq_production</span><br><span class="line"></span><br><span class="line"> Status   Migration ID    Migration Name</span><br><span class="line">--------------------------------------------------</span><br><span class="line">   up     20121220064453  Init schema</span><br><span class="line">	... ...	...</span><br><span class="line">   up     20170724214302  Add lower path index to redirect routes</span><br><span class="line">   up     20170725145659  Add binary to merge request diff files</span><br></pre></td></tr></table></figure>
<h1 id="汉化"><a href="#汉化" class="headerlink" title="汉化"></a>汉化</h1><h2 id="确认GitLab版本"><a href="#确认GitLab版本" class="headerlink" title="确认GitLab版本"></a>确认GitLab版本</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">cat /opt/gitlab/embedded/service/gitlab-rails/VERSION</span><br></pre></td></tr></table></figure>
<h2 id="克隆代码"><a href="#克隆代码" class="headerlink" title="克隆代码"></a>克隆代码</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">mkdir -p /opt/gitlab-zh </span><br><span class="line">cd /opt/gitlab-zh</span><br><span class="line">yum -y install git</span><br><span class="line"></span><br><span class="line"># 整个仓库300多M</span><br><span class="line"># git clone https://gitlab.com/xhang/gitlab.git</span><br><span class="line">cd /opt/gitlab-zh</span><br><span class="line">scp zhourudong@192.168.1.51:/tmp/gitpkg/gitlab_hanhua.tar.gz .</span><br><span class="line">tar xf gitlab_hanhua.tar.gz &amp;&amp; rm -f gitlab_hanhua.tar.gz  &amp;&amp; cd  gitlab</span><br><span class="line">git pull</span><br></pre></td></tr></table></figure>
<h2 id="比较汉化分支和原分支导出文件"><a href="#比较汉化分支和原分支导出文件" class="headerlink" title="比较汉化分支和原分支导出文件"></a>比较汉化分支和原分支导出文件</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">git diff origin/9-4-stable 9-4-stable-zh  &gt; /opt/gitlab-zh/9.4.diff</span><br></pre></td></tr></table></figure>
<h2 id="补丁"><a href="#补丁" class="headerlink" title="补丁"></a>补丁</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">cd /opt/gitlab-zh</span><br><span class="line">yum -y install patch</span><br><span class="line"></span><br><span class="line">#停止gitlab</span><br><span class="line">gitlab-ctl stop</span><br><span class="line"></span><br><span class="line">patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 &lt; /opt/gitlab-zh/9.4.diff</span><br><span class="line"></span><br><span class="line">#启动gitlab</span><br><span class="line">gitlab-ctl restart</span><br></pre></td></tr></table></figure>
<h1 id="备份恢复"><a href="#备份恢复" class="headerlink" title="备份恢复"></a>备份恢复</h1><p><a href="https://docs.gitlab.com/ce/raketasks/backup_restore.html" target="_blank" rel="external">https://docs.gitlab.com/ce/raketasks/backup_restore.html</a></p>
<h2 id="备份"><a href="#备份" class="headerlink" title="备份"></a>备份</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line"># 定时备份</span><br><span class="line">0 1 * * * /usr/bin/gitlab-rake gitlab:backup:create</span><br></pre></td></tr></table></figure>
<p><code>/etc/gitlab/gitlab.rb</code><br><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">gitlab_rails[&apos;backup_keep_time&apos;] = 604800   # 一周, 默认为0</span><br></pre></td></tr></table></figure></p>
<h2 id="恢复"><a href="#恢复" class="headerlink" title="恢复"></a>恢复</h2><p><code>首先进入备份 gitlab 的目录</code>,这个目录是配置文件中的gitlab_rails[‘backup_path’]，默认为<code>/var/opt/gitlab/backups</code>.<br>然后停止 unicorn 和 sidekiq ，保证数据库没有新的连接，不会有写数据情况。<br><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">sudo gitlab-ctl stop unicorn</span><br><span class="line"><span class="meta">#</span> ok: down: unicorn: 0s, normally up</span><br><span class="line"></span><br><span class="line">sudo gitlab-ctl stop sidekiq</span><br><span class="line"><span class="meta">#</span> ok: down: sidekiq: 0s, normally up</span><br></pre></td></tr></table></figure></p>
<p>查看备份文件时间戳, <code>1502957534_2017_08_17_9.4.5</code>为备份文件的时间戳<br><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span> 恢复</span><br><span class="line">ls /var/opt/gitlab/backups</span><br><span class="line"><span class="meta">#</span> 1503395474_2017_08_22_9.4.5_gitlab_backup.tar</span><br><span class="line"></span><br><span class="line">gitlab-rake gitlab:backup:restore BACKUP=1502957534_2017_08_17_9.4.5</span><br></pre></td></tr></table></figure></p>
<h2 id="数据迁移"><a href="#数据迁移" class="headerlink" title="数据迁移"></a>数据迁移</h2><p>首先需要暂停服务，避免用户在迁移期间读写数据：<br><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">gitlab-ctl stop</span><br><span class="line"></span><br><span class="line">rsync -av /var/opt/gitlab/git-data/repositories /path/to/git-data/</span><br><span class="line"></span><br><span class="line">sudo gitlab-ctl start</span><br><span class="line"></span><br><span class="line">sudo gitlab-ctl reconfigure</span><br></pre></td></tr></table></figure></p>
<h1 id="pgsql修改"><a href="#pgsql修改" class="headerlink" title="pgsql修改"></a>pgsql修改</h1><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span> 极少情况下需要修改(修改最大权限示例)</span><br><span class="line">vim /var/opt/gitlab/postgresql/data/postgresql.conf</span><br><span class="line">listen_addresses = '*'  # 默认只开放本地socket方式连接</span><br><span class="line"><span class="meta"></span><br><span class="line">#</span> 极少情况下需要修改(修改最大权限示例)</span><br><span class="line">vim /var/opt/gitlab/postgresql/data/pg_hba.conf </span><br><span class="line">host	all	all	192.168.1.203/32	trust</span><br></pre></td></tr></table></figure>
<h1 id="清缓存"><a href="#清缓存" class="headerlink" title="清缓存"></a>清缓存</h1><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span> 清空redis缓存</span><br><span class="line">gitlab-rake  cache:clear RAILS_ENV=production</span><br><span class="line">gitlab-rake cache:clear</span><br></pre></td></tr></table></figure>
<h1 id="大型文件、二进制文件对象相关"><a href="#大型文件、二进制文件对象相关" class="headerlink" title="大型文件、二进制文件对象相关"></a>大型文件、二进制文件对象相关</h1><p><a href="https://docs.gitlab.com/ce/workflow/lfs/manage_large_binaries_with_git_lfs.html" target="_blank" rel="external">https://docs.gitlab.com/ce/workflow/lfs/manage_large_binaries_with_git_lfs.html</a></p>
<p><a href="https://docs.gitlab.com/ce/workflow/lfs/lfs_administration.html" target="_blank" rel="external">https://docs.gitlab.com/ce/workflow/lfs/lfs_administration.html</a></p>
<h1 id="Gitaly-RPC调用配置"><a href="#Gitaly-RPC调用配置" class="headerlink" title="Gitaly RPC调用配置"></a>Gitaly RPC调用配置</h1><p>存储服务等配置</p>
<p>默认情况下开启<br><a href="https://docs.gitlab.com/ce/administration/gitaly/index.html" target="_blank" rel="external">https://docs.gitlab.com/ce/administration/gitaly/index.html</a><br><code>/etc/default/gitlab</code>  添加 <code>gitaly_enabled=false</code>，重载配置生效</p>
<h1 id="监控"><a href="#监控" class="headerlink" title="监控"></a>监控</h1><h2 id="白名单"><a href="#白名单" class="headerlink" title="白名单"></a>白名单</h2><p><code>/etc/gitlab/gitlab.rb</code>谁能访问<br><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">gitlab_rails[&apos;monitoring_whitelist&apos;] = [&apos;127.0.0.0/8&apos;, &apos;192.168.0.1&apos;]</span><br></pre></td></tr></table></figure></p>
<p><strong>Admin area ➔ Monitoring ➔ Health check</strong> (<code>admin/health_check</code>) </p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">https://gitlab.example.com/-/readiness?token=ACCESS_TOKEN</span><br></pre></td></tr></table></figure>
<h2 id="Prometheus-监控"><a href="#Prometheus-监控" class="headerlink" title="Prometheus 监控"></a>Prometheus 监控</h2><p><code>默认开启</code>监听地址为localhost</p>
<p><code>/etc/gitlab/gitlab.rb</code>  修改配置文件禁用此服务</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">prometheus_monitoring['enable'] = false</span><br><span class="line">prometheus['listen_address'] = 'localhost:9090'</span><br><span class="line"><span class="meta">#</span> gitlab-ctl reconfigure</span><br></pre></td></tr></table></figure>
<p><a href="https://docs.gitlab.com/ce/administration/monitoring/prometheus/index.html" target="_blank" rel="external">https://docs.gitlab.com/ce/administration/monitoring/prometheus/index.html</a></p>
<h2 id="设置redis-session过期"><a href="#设置redis-session过期" class="headerlink" title="设置redis session过期"></a>设置redis session过期</h2><figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">rcli() &#123;</span><br><span class="line">  # This example works for Omnibus installations of GitLab 7.3 or newer. For an</span><br><span class="line">  # installation from source you will have to change the socket path and the</span><br><span class="line">  # path to redis-cli.</span><br><span class="line">  sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket &quot;$@&quot;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"># test the new shell function; the response should be PONG</span><br><span class="line">rcli ping</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line"># Tell Redis to expire each matched key after 600 seconds.</span><br><span class="line">rcli keys &apos;*&apos; | grep &apos;^[a-f0-9]\&#123;32\&#125;$&apos; | awk &apos;&#123; print &quot;expire&quot;, $0, 600 &#125;&apos; | rcli</span><br><span class="line"># This will print &apos;(integer) 1&apos; for each key that gets expired.</span><br></pre></td></tr></table></figure>
<h1 id="CHECK"><a href="#CHECK" class="headerlink" title="CHECK"></a>CHECK</h1><h2 id="当前配置是否有问题"><a href="#当前配置是否有问题" class="headerlink" title="当前配置是否有问题"></a>当前配置是否有问题</h2><figure class="highlight shell"><table><tr><td class="code"><pre><span class="line">sudo gitlab-rake gitlab:check</span><br></pre></td></tr></table></figure>
<p>检查git仓库</p>
<figure class="highlight shell"><table><tr><td class="code"><pre><span class="line"><span class="meta">#</span> dangling commit 检查是否有悬空的提交</span><br><span class="line">gitlab-rake gitlab:repo:check</span><br><span class="line"><span class="meta">#</span> 检查用户是否有问题，相对于某个仓库,默认所有</span><br><span class="line">gitlab-rake gitlab:user:check_repos[root]</span><br></pre></td></tr></table></figure>
<p><a href="https://docs.gitlab.com/ce/administration/raketasks/ldap.html#check" target="_blank" rel="external">https://docs.gitlab.com/ce/administration/raketasks/ldap.html#check</a></p>
<p><a href="https://docs.gitlab.com/ce/administration/repository_checks.html、" target="_blank" rel="external">https://docs.gitlab.com/ce/administration/repository_checks.html、</a></p>
<h1 id="Performance"><a href="#Performance" class="headerlink" title="Performance"></a>Performance</h1><ul>
<li><a href="https://docs.gitlab.com/ce/administration/housekeeping.html" target="_blank" rel="external">Housekeeping</a>: Keep your Git repository tidy and fast.</li>
<li><a href="https://docs.gitlab.com/ce/administration/operations.html" target="_blank" rel="external">Operations</a>: Keeping GitLab up and running.</li>
<li><a href="https://docs.gitlab.com/ce/administration/polling.html" target="_blank" rel="external">Polling</a>: Configure how often the GitLab UI polls for updates.</li>
<li><a href="https://docs.gitlab.com/ce/administration/monitoring/performance/request_profiling.html" target="_blank" rel="external">Request Profiling</a>: Get a detailed profile on slow requests.</li>
<li><a href="https://docs.gitlab.com/ce/administration/monitoring/performance/performance_bar.html" target="_blank" rel="external">Performance Bar</a>: Get performance information for the current page</li>
</ul>
<h1 id="存储路径配置"><a href="#存储路径配置" class="headerlink" title="存储路径配置"></a>存储路径配置</h1><p><a href="https://docs.gitlab.com/ce/administration/repository_storage_paths.html" target="_blank" rel="external">https://docs.gitlab.com/ce/administration/repository_storage_paths.html</a></p>
<h1 id="升级参考地址"><a href="#升级参考地址" class="headerlink" title="升级参考地址"></a>升级参考地址</h1><p><a href="http://interprism.hatenablog.com/entry/gitlab6to8" target="_blank" rel="external">http://interprism.hatenablog.com/entry/gitlab6to8</a></p>
<p><a href="http://theterminallife.com/migrating-gitlab-to-gitlab-omnibus/" target="_blank" rel="external">http://theterminallife.com/migrating-gitlab-to-gitlab-omnibus/</a></p>
<p><a href="http://docs.gitlab.com/omnibus/update/README.html" target="_blank" rel="external">http://docs.gitlab.com/omnibus/update/README.html</a></p>
<p><a href="https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2109" target="_blank" rel="external">https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2109</a></p>

        </div>

        <blockquote class="post-copyright">
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2019-02-22T05:28:07.829Z" itemprop="dateUpdated">2019-02-22 13:28:07</time>
</span><br>


        
        <a href="/2017/08/24/45-gitlab维护/" target="_blank" rel="external">http://zhourudong.cn/2017/08/24/45-gitlab维护/</a>
        
    </div>
    <footer>
        <a href="http://zhourudong.cn">
            <img src="/img/avatar.png" alt="cucy">
            cucy
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/gitlab/">gitlab</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://zhourudong.cn/2017/08/24/45-gitlab维护/&title=《gitlab维护》 — Cucy的博客&pic=http://zhourudong.cn/img/avatar.png" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://zhourudong.cn/2017/08/24/45-gitlab维护/&title=《gitlab维护》 — Cucy的博客&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://zhourudong.cn/2017/08/24/45-gitlab维护/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《gitlab维护》 — Cucy的博客&url=http://zhourudong.cn/2017/08/24/45-gitlab维护/&via=http://zhourudong.cn" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://zhourudong.cn/2017/08/24/45-gitlab维护/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2017/09/08/46-django-用户模型翻译/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">django 用户模型翻译</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2017/08/24/44-GitLab7-9-2升级到9-4-5最新版本/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">GitLab7.9.2升级到9.4.5最新版本</h4>
      </a>
    </div>
  
</nav>



    














</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        谢谢大爷~
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/img/wechat.jpg" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/img/wechat.jpg" data-alipay="/img/alipay.jpg">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>cucy &copy; 2016 - 2021</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://zhourudong.cn/2017/08/24/45-gitlab维护/&title=《gitlab维护》 — Cucy的博客&pic=http://zhourudong.cn/img/avatar.png" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://zhourudong.cn/2017/08/24/45-gitlab维护/&title=《gitlab维护》 — Cucy的博客&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://zhourudong.cn/2017/08/24/45-gitlab维护/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《gitlab维护》 — Cucy的博客&url=http://zhourudong.cn/2017/08/24/45-gitlab维护/&via=http://zhourudong.cn" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://zhourudong.cn/2017/08/24/45-gitlab维护/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=http://zhourudong.cn/2017/08/24/45-gitlab维护/" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="/js/main.min.js?v=1.6.13"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="/js/search.min.js?v=1.6.13" async></script>






<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
